Public Class modificarGrupo
    Private objG As capaNegocios.Gestor = objG.instanciar()
    Private idGrupo As Integer

    Public Sub cargarDatos(ByVal pperi As String, ByVal phora As String, ByVal pasi As String, ByVal pidG As Integer)
        Me.periodo.Text = pperi
        Me.horario.Text = phora
        Me.asistente.Text = pasi
        Me.idGrupo = pidG
    End Sub

    Private Sub modificarGrupo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.cargarListaCursos()
    End Sub


    Public Sub cargarListaCursos()
        Dim datos As DataTable = objG.mostrarCursos()
        listaCursos.DataSource = datos
    End Sub


    Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Agregar.Click
        Dim horario, periodo, asistente As String
        Dim idC, fila As Integer
        fila = listaCursos.CurrentRow.Index
        periodo = Me.periodo.Text
        horario = Me.horario.Text
        asistente = Me.asistente.Text
        idC = CInt(listaCursos(2, fila).Value)
        Try
            objG.actualizarGrupo(periodo, horario, asistente, idC, Me.idGrupo)
            Me.DialogResult = Windows.Forms.DialogResult.OK
            MessageBox.Show("Fue ingresado satisfactoriamente", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Me.DialogResult = Windows.Forms.DialogResult.None
        End Try
    End Sub

    Private Sub Cancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Close()
    End Sub

    Private Sub RegistrarCurso_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles registrarCurso.Click
        Using RegistrarCurso As New registrarCurso
            If RegistrarCurso.ShowDialog() = Windows.Forms.DialogResult.OK Then
            End If
            Me.cargarListaCursos()
        End Using
        Me.DialogResult = Windows.Forms.DialogResult.None
    End Sub
End Class